var HomeBiz = {
		initialize : function(){
			
			$('#logout_btn').on('click', function(){
				COMMAJAX.common_ajax({
					url : "/mind/home/logoutcheck.do",
					callback_fnc : function(){
						window.setTimeout('location.reload()', 1000);
					}
				});
			});

			// Log-In Check
			/*$('#current').on("click" ,function(){
				var paramData = {};
				paramData["USER_PWD"] = $('#txt_pwd').val();
				paramData["USER_ID"] = $('#txt_email').val();
				
				COMMAJAX.common_ajax({
					url : "/mind/home/loginCheck.do"
						,data : paramData
						,callback_fnc :  function(data){
							if(data.rows == "N"){
								alert("로그인 아이디 또는 비밀번호가 올바르지 않습니다. 다시확인해주세!")
							}else{
								$('#txt_email').hide();
								$('#txt_pwd').hide();
								$('#current').remove();
								$('#joinLink').remove();
								if(data.rows.AUTH_YN){
									if(data.rows.AUTH_YN == "Y"){
										$('header ul:eq(1)').append('<li><a href="/views/work.do" >관리페이지</a></li>');
									}
								}
								$('header ul:eq(1)').append('<li><a class="logout_btn" id="logout_btn">나가기</a></li>');
								$('#header_left li:eq(0)').html("<strong>" + data.rows.USER_NAME +"</strong> 님, 반갑습니다.")
								
								if(data.rows.CNT != 0){
									var tag = "";
									tag += '<li><div id="Messages">';
									tag += '<div class="bubble">';
									tag += '<p class="label" id="lbl_cmt_cnt" style="cursor: pointer;">' + data.rows.CNT +'</p>';
									tag += '</div>';
									tag += '</div></li>';
									
									$('#header_right').append(tag);
								}

                                var rowCnt = data.rows["content"].length;
                                var tag = "";

                                for(var i = 0; i < rowCnt ; i++){
                                    tag += "<span style='width: 40px'>";
                                    tag += data.rows["content"][i]["REPLY_USER_NAME"];
                                    tag += "</span>";
                                    tag += "<span style='width: 100px'>";
                                    tag += data.rows["content"][i]["REPLY_CONTENT"];
                                    tag += "</span>";
                                    tag += "<a href='/views/blogpost.do?BLOG_NO="+ data.rows["content"][i]["PARENT_BLOG_NO"] + "' class='ketchup tooltip' title='This is my links tooltip message!'>Link</a>";
                                    tag += "</br>";
                                }

                                $('.bubble').tooltipster({
                                    content: $(tag),
                                    contentAsHTML : true,
                                    autoClose : true,
                                    interactive : true,
                                    position : 'bottom'
                                });

                                (function poll(){
                                    HomeBiz["setTimeOut"] = setTimeout(function(){
                                        $.ajax({ url: "/mind/checkReplyAndContents.do", success: function(data){

                                            if(data["replyCnt"] != 0 ){
                                                $('.bubble').remove();

                                                $('#Messages').append("<div class='bubble'><p class='label' id='lbl_cmt_cnt' style='cursor: pointer;' > " + data["replyCnt"] + "</p></div>");
                                            }

                                            //Update your dashboard gauge
                                            if(data["replyData"].length > 0){
                                                var audio = $('audio')[0];
                                                audio.play();

                                                var rowCnt = data["replyData"].length;
                                                var tag = "";

                                                for(var i = 0; i < rowCnt ; i++){
                                                    tag += "<span>";
                                                    tag += data["replyData"][i]["REPLY_USER_NAME"];
                                                    tag += "</span>";
                                                    tag += "<span>";
                                                    tag += data["replyData"][i]["REPLY_CONTENT"];
                                                    tag += "</span>";
                                                    tag += "<a href='/views/blogpost.do?BLOG_NO="+ data["replyData"][i]["PARENT_BLOG_NO"] + "' class='ketchup tooltip' title='This is my links tooltip message!'>Link</a>";
                                                    tag += "</br>";
                                                }

                                                $('.bubble').tooltipster({
                                                    content: $(tag),
                                                    contentAsHTML : true,
                                                    autoClose : true,
                                                    interactive : true,
                                                    position : 'bottom'
                                                });
                                            }



                                            //Setup the next poll recursively
                                            poll();
                                        }, dataType: "json"});
                                    }, 10000);
                                })();

                                 //$('.bubble').append("<div id='tooltip_call' style='height: 5px;width: 5px' ></div>");




                                $('#logout_btn').unbind('click').bind('click', function(){
									COMMAJAX.common_ajax({
										url : "/mind/home/logoutcheck.do",
										callback_fnc : function(){

                                            clearInterval(HomeBiz.setTimeOut);

											window.setTimeout('location.reload()', 1000);
										}
									});
								});
							}
						}
				});
			});*/
		}
}


!function($){
	HomeBiz.initialize();	
}(jQuery);